package com.xuanxu.blogs.module.user.controller.app;

import com.xuanxu.blogs.module.user.entity.vo.app.PasswordLoginRequestVo;
import com.xuanxu.blogs.module.user.service.AuthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author XuanXu
 * @version 1.0
 * @date 2024-08-20 16:19
 */
@RestController
@RequestMapping("/app-api/auth")
@RequiredArgsConstructor
@Api(tags = "认证相关接口")
public class AppAuthController {

    private final AuthService authService;

    @PostMapping("/login")
    @ApiOperation("账号密码登录")
    public ResponseEntity<String> login(@RequestBody PasswordLoginRequestVo passwordLoginRequestVo) {
        String token = authService.login(passwordLoginRequestVo);
        return ResponseEntity.ok(token);
    }
}
